#include "StdAfx.h"

#include "game/Game.h"
#include "sys/System.h"
#include "engine/SimpleObj.h"
#include "sound/ModPlayer.h"

#ifdef OS_WIN32
void main()
#else
void NitroMain()
#endif
{
	CSystem *sys = CSystem::getInstance();
		
	sys->initSystem();

	CGame* pGame = CGame::getInstance();	

	if ( pGame->init() == FALSE )
	{
		OS_Panic("ARM9: Failed to alloc the main game class...\n");
	}
	
  	sys->setVideoMode(CSystem::VIDEOMODE_3D);
  	sys->setFOV(30);
	
	GX_VBlankIntr(TRUE);
	
	CSimpleObj::buildCheckerTex();    

	CModPlayer::getInstance()->play();


	while (TRUE)
	{
		sys->setRendering(TRUE);
		pGame->timerCallback();
		sys->copyScreens();
		sys->setRendering(FALSE);
		OS_WaitVBlankIntr();
		pGame->frameDelay();
	}
}